package com.xuliugen.javamybatis.demo.decorator;

/**
 * Created by xuliugen on 2017/11/8.
 */
public abstract class Decorator extends Component {

    /**
     * 持有组件对象
     */
    protected Component component;

    /**
     * 构造方法，传入组件对象
     * @param component 组件对象
     */
    public Decorator(Component component) {
        this.component = component;
    }

    @Override
    public void operation() {
        //1、动作1

        //转发请求给组件对象，可以在转发前后执行一些附加动作
        component.operation();

        //2、动作2
    }
}
